package com.training.iyogo.domain;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

/**
 * @会员个人信息{ vipId Long,
 * 	 name String,
 * 	 address String,
 * 	 job String 
 * }
 */
@Entity
@Table
public class VIP implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long vipId;// 会员编号
	private String name;// 会员姓名
	private String address;// 会员家庭地址
	private String job;// 会员职业
	
	@OneToMany(targetEntity=Card.class,mappedBy="owner",fetch=FetchType.EAGER)
	@Cascade(value=CascadeType.ALL)
	private Set<Card> cards=new HashSet<>();// 拥有的卡
	
	@OneToMany(targetEntity=Schedule.class,mappedBy="vip",fetch=FetchType.EAGER)
	@Cascade(value=CascadeType.ALL)
	private Set<Schedule> schedules=new HashSet<>();// 预定课程
	/**
	 * @return the vipId
	 */
	public Long getVipId() {
		return vipId;
	}
	/**
	 * @param vipId the vipId to set
	 */
	public void setVipId(Long vipId) {
		this.vipId = vipId;
	}
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	/**
	 * @return the address
	 */
	public String getAddress() {
		return address;
	}
	/**
	 * @param address the address to set
	 */
	public void setAddress(String address) {
		this.address = address;
	}
	/**
	 * @return the job
	 */
	public String getJob() {
		return job;
	}
	/**
	 * @param job the job to set
	 */
	public void setJob(String job) {
		this.job = job;
	}
	/**
	 * @return the serialversionuid
	 */
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	/**
	 * @return the cards
	 */
	public Set<Card> getCards() {
		return cards;
	}
	/**
	 * @param cards the cards to set
	 */
	public void setCards(Set<Card> cards) {
		this.cards = cards;
	}
	/**
	 * @return the schedules
	 */
	public Set<Schedule> getSchedules() {
		return schedules;
	}
	/**
	 * @param schedules the schedules to set
	 */
	public void setSchedules(Set<Schedule> schedules) {
		this.schedules = schedules;
	}
	
}
